﻿using EasyLucky.Common;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Media;
using System.Windows.Media.Imaging;

namespace EasyLucky.Models
{
    public  class GiftM:Gift
    {
        public ImageSource ImageSource { get; set; }

        public void ReadImage()
        {
            byte[] imageData = File.ReadAllBytes(ImageUrl);

            using (MemoryStream ms = new MemoryStream(imageData))
            {

                BitmapImage bi = new BitmapImage();

                bi.BeginInit();

                bi.StreamSource = ms;

                bi.CacheOption = BitmapCacheOption.OnLoad;

                bi.EndInit();

                ImageSource = bi;

            }
        }
    }
}
